﻿// Copyright (c) 2009, Moolah Project Team. All rights reserved.
// For continued development and updates, visit http://www.codeplex.com/moolah
// For a copy of the license please vist: http://www.codeplex.com/moolah/license
using System;

namespace Moolah.Core
{
    public interface ICacheLocator : IServiceProvider
    {
        /// <summary>
        /// Adds the object to the cache with the supplied key to the object
        /// throws an exception if item already exists in cache.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        void Add<T>(string key, T obj);

        /// <summary>
        /// Put the object to the cache with the supplied key to the object
        /// replaces existing item if item already exists in cache.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        void Put<T>(string key, T obj);

        /// <summary>
        /// Gets the object from the cache with supplied key.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        T Get<T>(string key);

        /// <summary>
        /// Removes the object from the cache with supplied key.
        /// </summary>
        /// <param name="key">The key.</param>
        void Remove(string key);

        /// <summary>
        /// Purges all items from the cache.
        /// </summary>
        void Purge();
    }
}